<?php

/**
 * Services form.
 *
 * @package    jobeet
 * @subpackage form
 * @author     Your name here
 */
class ServicesForm extends BaseServicesForm
{
  public function configure()
  {
      
      /*Переопределяем поле file. Теперь это поле загрузки файла в папку web/uploads/services*/
      $this->widgetSchema['file'] = new sfWidgetFormInputFileEditable(array(
                                                                    'file_src' => '/uploads/services/'.$this->getObject()->getFile(),
                                                                    'is_image' => true,
                                                                    'edit_mode' => !$this->isNew(),
                                                                    'delete_label' => 'Удалить текущее изображение',
                                                                    'template'  => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>',));
      
      $this->validatorSchema['file'] = new sfValidatorFile(array(
                                                        'mime_types' => 'web_images',
                                                        'path' => sfConfig::get('sf_upload_dir').'/services',
                                                        'required' => false,
                                                        ));
      $this->validatorSchema['file_delete'] = new sfValidatorPass();
      $this->widgetSchema['description'] = new sfWidgetFormTextareaTinyMCE( array('config' => TinyConfig::TINY_CONFIG) );
      $this->validatorSchema['description'] = new sfValidatorPass(array('required' => false));
  }
}  
